home *** CD-ROM | disk | FTP | other *** search
/ C++ für Kids / C++ for kids.iso / SETUP / US / CBUILDER / DATA.Z / GRAPHICS.H < prev    next >
C/C++ Source or Header  |  1997-02-13  |  17KB  |  506 lines

  1. /*  graphics.h
  2.  
  3.     Definitions for Graphics Package.
  4.  
  5. */
  6.  
  7. /*
  8.  *      C/C++ Run Time Library - Version 8.0
  9.  *
  10.  *      Copyright (c) 1987, 1997 by Borland International
  11.  *      All Rights Reserved.
  12.  *
  13.  */
  14. /* $Revision:   8.1  $ */
  15.  
  16. #if !defined(__GRAPHICS_H)
  17. #define __GRAPHICS_H
  18.  
  19. #if defined( _Windows ) && !defined (__DPMI16__) && !defined(__DPMI32__)
  20. #error BGI graphics not supported under Windows
  21. #endif
  22.  
  23. #if defined(__STDC__)
  24. #error BGI graphics not ANSI compatible
  25. #endif
  26.  
  27. #if !defined(___DEFS_H)
  28. #include <_defs.h>
  29. #endif
  30.  
  31. #if !defined(_BGIENTRY)
  32.     #if defined(__DPMI16__)
  33.         #define _BGIENTRY __pascal
  34.     #elif defined(__DPMI32__)
  35.         #define _BGIENTRY _RTLENTRY __import
  36.     #else
  37.         #define _BGIENTRY _RTLENTRY
  38.     #endif
  39. #endif
  40.  
  41. #if defined(__DPMI32__)
  42. #define far
  43. #define huge
  44. #endif
  45.  
  46. enum graphics_errors {      /* graphresult error return codes */
  47.     grOk           =   0,
  48.     grNoInitGraph      =  -1,
  49.     grNotDetected      =  -2,
  50.     grFileNotFound     =  -3,
  51.     grInvalidDriver    =  -4,
  52.     grNoLoadMem    =  -5,
  53.     grNoScanMem    =  -6,
  54.     grNoFloodMem       =  -7,
  55.     grFontNotFound     =  -8,
  56.     grNoFontMem    =  -9,
  57.     grInvalidMode      = -10,
  58.     grError        = -11,   /* generic error */
  59.     grIOerror      = -12,
  60.     grInvalidFont      = -13,
  61.     grInvalidFontNum   = -14,
  62.     grInvalidVersion   = -18
  63. };
  64.  
  65. enum graphics_drivers {     /* define graphics drivers */
  66.     DETECT,         /* requests autodetection */
  67.     CGA, MCGA, EGA, EGA64, EGAMONO, IBM8514,    /* 1 - 6 */
  68.     HERCMONO, ATT400, VGA, PC3270,          /* 7 - 10 */
  69.     CURRENT_DRIVER = -1
  70. };
  71.  
  72. enum graphics_modes {       /* graphics modes for each driver */
  73.     CGAC0      = 0,  /* 320x200 palette 0; 1 page   */
  74.     CGAC1      = 1,  /* 320x200 palette 1; 1 page   */
  75.     CGAC2      = 2,  /* 320x200 palette 2: 1 page   */
  76.     CGAC3      = 3,  /* 320x200 palette 3; 1 page   */
  77.     CGAHI      = 4,  /* 640x200 1 page          */
  78.     MCGAC0     = 0,  /* 320x200 palette 0; 1 page   */
  79.     MCGAC1     = 1,  /* 320x200 palette 1; 1 page   */
  80.     MCGAC2     = 2,  /* 320x200 palette 2; 1 page   */
  81.     MCGAC3     = 3,  /* 320x200 palette 3; 1 page   */
  82.     MCGAMED    = 4,  /* 640x200 1 page          */
  83.     MCGAHI     = 5,  /* 640x480 1 page          */
  84.     EGALO      = 0,  /* 640x200 16 color 4 pages    */
  85.     EGAHI      = 1,  /* 640x350 16 color 2 pages    */
  86.     EGA64LO    = 0,  /* 640x200 16 color 1 page     */
  87.     EGA64HI    = 1,  /* 640x350 4 color  1 page     */
  88.     EGAMONOHI  = 0,  /* 640x350 64K on card, 1 page - 256K on card, 4 pages */
  89.     HERCMONOHI = 0,  /* 720x348 2 pages         */
  90.     ATT400C0   = 0,  /* 320x200 palette 0; 1 page   */
  91.     ATT400C1   = 1,  /* 320x200 palette 1; 1 page   */
  92.     ATT400C2   = 2,  /* 320x200 palette 2; 1 page   */
  93.     ATT400C3   = 3,  /* 320x200 palette 3; 1 page   */
  94.     ATT400MED  = 4,  /* 640x200 1 page          */
  95.     ATT400HI   = 5,  /* 640x400 1 page          */
  96.     VGALO      = 0,  /* 640x200 16 color 4 pages    */
  97.     VGAMED     = 1,  /* 640x350 16 color 2 pages    */
  98.     VGAHI      = 2,  /* 640x480 16 color 1 page     */
  99.     PC3270HI   = 0,  /* 720x350 1 page          */
  100.     IBM8514LO  = 0,  /* 640x480 256 colors      */
  101.     IBM8514HI  = 1   /*1024x768 256 colors      */
  102. };
  103.  
  104.  
  105. #if defined(__DPMI32__)
  106. /*  graphicx.h
  107.  
  108.     Extended Definitions for Graphics Package.
  109.  
  110. */
  111.  
  112.  
  113. enum Xgraphics_drivers {     /* define extended graphics drivers */
  114.     DETECTX    = 256,
  115.     VGA256     = 11,
  116.     ATTDEB     = 12,
  117.     TOSHIBA    = 13,
  118.  
  119.     SVGA16     = 14,
  120.     SVGA256    = 15,
  121.     SVGA32K    = 16,
  122.     SVGA64K    = 17,
  123.  
  124.     VESA16     = 18,
  125.     VESA256    = 19,
  126.     VESA32K    = 20,
  127.     VESA64K    = 21,
  128.     VESA16M    = 22,
  129.  
  130.     ATI16      = 23,
  131.     ATI256     = 24,
  132.     ATI32K     = 25,
  133.     COMPAQ     = 26,
  134.     TSENG316   = 27,
  135.     TSENG3256  = 28,
  136.     TSENG416   = 29,
  137.     TSENG4256  = 30,
  138.     TSENG432K  = 31,
  139.     GENOA5     = 32,
  140.     GENOA6     = 33,
  141.     OAK        = 34,
  142.     PARADIS16  = 35,
  143.     PARADIS256 = 36,
  144.     TECMAR     = 37,
  145.     TRIDENT16  = 38,
  146.     TRIDENT256 = 39,
  147.     VIDEO7     = 40,
  148.     VIDEO7II   = 41,
  149.  
  150.     S3         = 42,
  151.     ATIGUP     = 43
  152.  
  153. };
  154.  
  155. enum Xgraphics_modes {       /* graphics modes for each driver */
  156.     RES640x350  = 0,
  157.     RES640x480  = 1,
  158.     RES800x600  = 2,
  159.     RES1024x768 = 3,
  160.     RES1280x1024 = 4,
  161. };
  162.  
  163.  
  164. #endif  /* !__DPMI32__ */
  165.  
  166.  
  167. /* Colors for setpalette and setallpalette */
  168.  
  169. #if !defined(__COLORS)
  170. #define __COLORS
  171.  
  172. enum COLORS {
  173.     BLACK,          /* dark colors */
  174.     BLUE,
  175.     GREEN,
  176.     CYAN,
  177.     RED,
  178.     MAGENTA,
  179.     BROWN,
  180.     LIGHTGRAY,
  181.     DARKGRAY,           /* light colors */
  182.     LIGHTBLUE,
  183.     LIGHTGREEN,
  184.     LIGHTCYAN,
  185.     LIGHTRED,
  186.     LIGHTMAGENTA,
  187.     YELLOW,
  188.     WHITE
  189. };
  190. #endif
  191.  
  192. enum CGA_COLORS {
  193.     CGA_LIGHTGREEN     = 1,     /* Palette C0 Color Names   */
  194.     CGA_LIGHTRED       = 2,
  195.     CGA_YELLOW         = 3,
  196.  
  197.     CGA_LIGHTCYAN      = 1,     /* Palette C1 Color Names   */
  198.     CGA_LIGHTMAGENTA   = 2,
  199.     CGA_WHITE          = 3,
  200.  
  201.     CGA_GREEN          = 1,     /* Palette C2 Color Names   */
  202.     CGA_RED        = 2,
  203.     CGA_BROWN          = 3,
  204.  
  205.     CGA_CYAN           = 1,     /* Palette C3 Color Names   */
  206.     CGA_MAGENTA        = 2,
  207.     CGA_LIGHTGRAY      = 3
  208. };
  209.  
  210.  
  211. enum EGA_COLORS {
  212.     EGA_BLACK        =  0,      /* dark colors */
  213.     EGA_BLUE         =  1,
  214.     EGA_GREEN        =  2,
  215.     EGA_CYAN         =  3,
  216.     EGA_RED      =  4,
  217.     EGA_MAGENTA      =  5,
  218.     EGA_BROWN        =  20,
  219.     EGA_LIGHTGRAY    =  7,
  220.     EGA_DARKGRAY     =  56,     /* light colors */
  221.     EGA_LIGHTBLUE    =  57,
  222.     EGA_LIGHTGREEN   =  58,
  223.     EGA_LIGHTCYAN    =  59,
  224.     EGA_LIGHTRED     =  60,
  225.     EGA_LIGHTMAGENTA     =  61,
  226.     EGA_YELLOW       =  62,
  227.     EGA_WHITE        =  63
  228. };
  229.  
  230. enum line_styles {      /* Line styles for get/setlinestyle */
  231.     SOLID_LINE   = 0,
  232.     DOTTED_LINE  = 1,
  233.     CENTER_LINE  = 2,
  234.     DASHED_LINE  = 3,
  235.     USERBIT_LINE = 4,   /* User defined line style */
  236. };
  237.  
  238. enum line_widths {      /* Line widths for get/setlinestyle */
  239.     NORM_WIDTH  = 1,
  240.     THICK_WIDTH = 3,
  241. };
  242.  
  243. enum font_names {
  244.     DEFAULT_FONT    = 0,    /* 8x8 bit mapped font */
  245.     TRIPLEX_FONT    = 1,    /* "Stroked" fonts */
  246.     SMALL_FONT  = 2,
  247.     SANS_SERIF_FONT = 3,
  248.     GOTHIC_FONT = 4,
  249.     SCRIPT_FONT = 5,
  250.     SIMPLEX_FONT = 6,
  251.     TRIPLEX_SCR_FONT = 7,
  252.     COMPLEX_FONT = 8,
  253.     EUROPEAN_FONT = 9,
  254.     BOLD_FONT = 10
  255. };
  256.  
  257. #define HORIZ_DIR   0   /* left to right */
  258. #define VERT_DIR    1   /* bottom to top */
  259.  
  260. #define USER_CHAR_SIZE  0   /* user-defined char size */
  261.  
  262. enum fill_patterns {        /* Fill patterns for get/setfillstyle */
  263.     EMPTY_FILL,     /* fills area in background color */
  264.     SOLID_FILL,     /* fills area in solid fill color */
  265.     LINE_FILL,      /* --- fill */
  266.     LTSLASH_FILL,       /* /// fill */
  267.     SLASH_FILL,     /* /// fill with thick lines */
  268.     BKSLASH_FILL,       /* \\\ fill with thick lines */
  269.     LTBKSLASH_FILL,     /* \\\ fill */
  270.     HATCH_FILL,     /* light hatch fill */
  271.     XHATCH_FILL,        /* heavy cross hatch fill */
  272.     INTERLEAVE_FILL,    /* interleaving line fill */
  273.     WIDE_DOT_FILL,      /* Widely spaced dot fill */
  274.     CLOSE_DOT_FILL,     /* Closely spaced dot fill */
  275.     USER_FILL       /* user defined fill */
  276. };
  277.  
  278. enum putimage_ops {     /* BitBlt operators for putimage */
  279.     COPY_PUT,       /* MOV */
  280.     XOR_PUT,        /* XOR */
  281.     OR_PUT,         /* OR  */
  282.     AND_PUT,        /* AND */
  283.     NOT_PUT         /* NOT */
  284. };
  285.  
  286. enum text_just {        /* Horizontal and vertical justification
  287.                    for settextjustify */
  288.     LEFT_TEXT   = 0,
  289.     CENTER_TEXT = 1,
  290.     RIGHT_TEXT  = 2,
  291.  
  292.     BOTTOM_TEXT = 0,
  293.      /* CENTER_TEXT = 1,  already defined above */
  294.     TOP_TEXT    = 2
  295. };
  296.  
  297.  
  298. #define MAXCOLORS 15
  299.  
  300. struct palettetype {
  301.     unsigned char size;
  302.     signed char colors[MAXCOLORS+1];
  303. };
  304.  
  305. struct linesettingstype {
  306.     int linestyle;
  307.     unsigned upattern